package wiki.hitime.stl.daq.enums;


import wiki.hitime.stl.daq.bean.base.NameValue;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public enum DataValueTypeEnum {

    // 值类型
    NUMBER(1, "数字"),
    DATETIME(2, "日期时间"),
    BOOLEAN(3, "布尔"),
    STRING(4, "文本");


    private int status;
    private String msg;

    DataValueTypeEnum(int status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public int getStatus() {
        return this.status;
    }

    public String getMsg() {
        return this.msg;
    }

    public static DataValueTypeEnum valueOf(int status) {
        for (DataValueTypeEnum enumItem : DataValueTypeEnum.values()) {
            if (enumItem.getStatus() == status) {
                return enumItem;
            }
        }
        return null;
    }

    public static List<NameValue> getList() {
        return Arrays.stream(DataValueTypeEnum.values()).map(item -> new NameValue(item.getMsg(), item.getStatus())).collect(Collectors.toList());
    }
}
